package com.kehutong.admin.controler;

import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.Bean;
import org.coraframework.mvc.http.ReqMapping;

import com.kehutong.admin.entity.MCache;
import com.kehutong.admin.util.service.CacheService;

/**
 * 对象缓存管理
 * 
 * @author liuzhen (liuxing521a@163.com)
 * @createTime 2020年6月19日下午4:49:56
 */
@MvcAction
@ReqMapping("/admin/sys/cache")
public class MCacheController {

    @Inject
    private CacheService cacheService;

    @HasPermission("sys:cache:view")
    @ReqMapping("/list")
    public Object list(JSONObject jsonObject) throws Exception {
    	return cacheService.list(jsonObject);
    }

    @Bean(newInstance=false, copy=true)
	@HasPermission("sys:cache:edit")
    @ReqMapping("/update")
    public Object update(MCache cache) throws Exception {
    	return cacheService.update(cache);
    }

    @HasPermission("sys:cache:edit")
    @ReqMapping("/synCache")
    public Object synCache() throws Exception {
    	return cacheService.synCache();
    }
}
